]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
grabHelper: Clean up the code a bit
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 3 Sep 2012 23:23:51 +0000 (20:23 -0300)
committerJasper St. Pierre <jstpierre@mecheye.net>
Wed, 5 Sep 2012 17:28:45 +0000 (14:28 -0300)
I don't remember why I added needsGrab in the first place.

js/ui/grabHelper.js

index 4eb3065a1e22b854aaf189b9847e1c8a462c2d5d..a4392cc6b55f766ed7012decf01c74959f7e06f9 100644 (file)
@@ -10,11 +10,12 @@ const St = imports.gi.St;
 const Main = imports.ui.main;
 const Params = imports.misc.params;
 
-function _navigateActor(actor, needsGrab) {
+function _navigateActor(actor) {
     if (!actor)
         return;
 
-    if (needsGrab && actor instanceof St.Widget)
+    let needsGrab = true;
+    if (actor instanceof St.Widget)
         needsGrab = !actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
     if (needsGrab)
         actor.grab_key_focus();
@@ -169,7 +170,8 @@ const GrabHelper = new Lang.Class({
         if (params.grabFocus)
             this._grabFocusCount++;
 
-        _navigateActor(newFocus, hadFocus);
+        if (hadFocus)
+            _navigateActor(newFocus);
 
         return true;
     },
@@ -254,7 +256,9 @@ const GrabHelper = new Lang.Class({
             this._fullUngrab(wasModal);
 
         let poppedGrab = poppedGrabs[0];
-        _navigateActor(poppedGrab.savedFocus, hadFocus);
+
+        if (hadFocus)
+            _navigateActor(poppedGrab.savedFocus);
     },
 
     _fullUngrab: function(wasModal) {